#include "startslot.h"
void startSlot::init(QObject * outside){
    rootObject = outside;
    swipeView = rootObject->findChild<QObject *>("pageview",Qt::FindDirectChildrenOnly);
}
void startSlot::slot_start(){
    arguments = "";
    currentpage =
        swipeView->property("currentItem").value<argumentsPage *>();
    std::string program = "./"+rootObject->property("backend").toString().toStdString();
    //获取被放置于外层的自定义属性的参数
    arguments += " --baseline=";
    arguments += rootObject->property("baselineFile").toString().toStdString();
    arguments += " --datapath=";
    arguments += rootObject->property("dataPath").toString().toStdString();
    //END获取被放置于外层的自定义属性的参数
    std::string arguments_in_page = currentpage->valid_arguments();
    arguments += arguments_in_page;
    //转化为Qstring
    QString qprogram = QString::fromStdString(program);
    QString tmp = QString::fromStdString(arguments);
    qarguments = tmp.split(QStringLiteral(" "), Qt::SkipEmptyParts);
    //END转化为Qstring
    qDebug() << qprogram << qarguments;
    backend.start(qprogram,qarguments);//不支持stdstring作为参数
}

